package com.zhongying.jf.huifuUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

/**
 * @author fengzhengjun
 * @Description
 * @Email fengzhengjun@chinazyjr.com
 * Created on 2017/8/30 13:30
 * Copyright (c) 2017 All Rights Reserved.
 */
public class HuifuUtils {
    /**
     * 本地测试用
     *
     * @param filePath
     * @return
     */
    public static Map<String, String> readProperties(String filePath) {
        Properties props = new Properties();
        Map<String, String> map = new HashMap<String, String>();
        try {
            InputStream in = new FileInputStream(new File(filePath));
            props.load(in);
            Enumeration en=props.propertyNames();
            while (en.hasMoreElements()) {
                String key=(String) en.nextElement();
                String property=props.getProperty(key);
                map.put(key, property);
            }
        }catch (IOException e){
            e.printStackTrace();
            return null;
        }
        return map;
    }
}
